--- @param extension Package
--- @param HY HY_Utility
--- @param U Utility
return function(extension, HY, U)
    local hy_x_yakumo_yukari = General:new(extension, "hy_x_yakumo_yukari", "x_k", 4, 4, General.Female)
    local separate_dimension = fk.CreateSkill {
        name = "separate_dimension",
    }
    separate_dimension:addEffect(fk.EventPhaseStart, {
        anim_type = "switch",
        can_trigger = function(self, event, target, player, data)
            return player:hasSkill(self) and player:getMark("separate_dimension") % 2 == 1 and target == player and target.phase == Player.Start
        end,
        on_cost = Util.TrueFunc,
        on_use = function(self, event, target, player, data)
            local room = player.room
            room:drawCards(target, 2, separate_dimension.name)
        end,
    })
    separate_dimension:addEffect(fk.DrawNCards, {
        anim_type = "switch",
        can_trigger = function(self, event, target, player, data)
            return player:hasSkill(self) and player:getMark("separate_dimension") % 2 == 1 and target ~= player and target.kingdom == player.kingdom and data.n > 0
        end,
        on_cost = Util.TrueFunc,
        on_use = function(self, event, target, player, data)
            data.n = data.n - 1
        end,
    })
    separate_dimension:addEffect(fk.RoundEnd, {
        anim_type = "switch",
        can_trigger = function(self, event, target, player, data)
            return player:hasSkill(self)
        end,
        on_cost = Util.TrueFunc,
        on_use = function(self, event, target, player, data)
            local room = player.room
            HY.AskForChangeKingdom(player, room, separate_dimension.name, true)
        end,
    })
    separate_dimension:addEffect(fk.RoundStart, {
        can_refresh = function(self, event, target, player, data)
            return player:getMark("separate_dimension") ~= player.room:getBanner("RoundCount")
        end,
        on_refresh = function(self, event, target, player, data)
            local room = player.room
            room:setPlayerMark(player, "separate_dimension", room:getBanner("RoundCount"))
        end
    })
    separate_dimension:addEffect(fk.PreCardUse, {
        can_refresh = function(self, event, target, player, data)
            return player:hasSkill(self) and not player.dead and player:getMark("separate_dimension") % 2 == 0 and target ~= player and target.kingdom == player.kingdom
        end,
        on_refresh = function(self, event, target, player, data)
            local room = player.room
            if data.card:getTypeString() == "notype" then
                return
            end
            room:addPlayerMark(target, "separate_dimension-turn", 1)
            if target:getMark("separate_dimension-turn") < 3 then
                room:setPlayerMark(target, "@separate_dimension_prohibit-turn", data.card:getTypeString())
            else
                room:setPlayerMark(target, "@separate_dimension_prohibit-turn", 0)
            end
        end
    })
    separate_dimension:addEffect(fk.Death, {
        can_refresh = function(self, event, target, player, data)
            return player:hasSkill(self, true, true) and target == player
        end,
        on_refresh = function(self, event, target, player, data)
            local room = player.room
            for _, t in ipairs(room.alive_players) do
                room:setPlayerMark(t, "@separate_dimension_prohibit-turn", 0)
            end
        end
    })
    separate_dimension:addEffect("prohibit", {
        prohibit_use = function(self, player, card)
            return card and type(player:getMark("@separate_dimension_prohibit-turn")) == "string" and player:getMark("@separate_dimension_prohibit-turn") ~= card:getTypeString()
        end
    })
    separate_dimension:addEffect("maxcards", {
        correct_func = function(self, player)
            if player:getMark("separate_dimension") % 2 == 1 and player:hasSkill(self) then
                return 3
            end
        end
    })
    separate_dimension:addEffect("targetmod", {
        bypass_times = function(self, player, skill, scope, card, to)
            if player:getMark("separate_dimension") > 0 and player:getMark("separate_dimension") % 2 == 0 and player:hasSkill(self) then
                return true
            end
        end,
        bypass_distances = function(self, player, skill, card, to)
            if player:getMark("separate_dimension") > 0 and player:getMark("separate_dimension") % 2 == 0 and player:hasSkill(self) then
                return true
            end
        end
    })
    extension:loadSkillSkels { separate_dimension }
    hy_x_yakumo_yukari:addSkill("separate_dimension")
    Fk:loadTranslationTable {
        ["hy_x_yakumo_yukari"] = "八云紫",
        ["#hy_x_yakumo_yukari"] = "概念的彼端",
        ["illustrator:hy_x_yakumo_yukari"] = "木村棗",
        ["designer:hy_x_yakumo_yukari"] = "黑曜人形",
        ["cv:hy_x_yakumo_yukari"] = "",

        ["separate_dimension"] = "离境",
        [":separate_dimension"] = "若当前轮数为：奇数，与你同势力的其他角色摸牌阶段少摸一张牌，你于准备阶段摸两张牌，你的手牌上限+3；偶数，与你同势力的其他角色每回合使用的前三张牌须类型相同，你使用牌无次数距离限制。每轮结束时，你变更势力。",
        ["@separate_dimension_prohibit-turn"] = "离境",
    }
end
